package com.tanhua.dubbo.api.db;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanhua.dubbo.api.mapper.SoulOptionMapper;
import com.tanhua.model.db.Option;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author zs
 * @version 1.8
 */
@DubboService
public class SoulOptionApiImpl implements SoulOptionApi{

    @Autowired
    private SoulOptionMapper soulOptionMapper;

    /**
     * 根据选项id 查询 对应的分数
     *
     * @param optionId
     * @return
     */
    @Override
    public Integer findScoreByoptionId(Integer optionId) {
        LambdaQueryWrapper<Option> lqw = new LambdaQueryWrapper<>();
        lqw.eq(optionId!=null, Option::getOptionId,optionId);
        Option option = soulOptionMapper.selectOne(lqw);
        Integer score = option.getScore();
        return score;
    }
}
